package acwing._1_1AlgorithmBasic._4Math;
/**
 * @Project : AlgorithmLearning
 * @Package : ACWing._1_1AlgorithmBasic._4Math
 * @File : Q0866.java
 * @Author : WangRuoyu
 * @Date : 2023/4/3 21:39
 */

import java.io.*;

public class Q0866 {
    static boolean isPrime(int x) {
        if (x <= 1) {
            return false;
        }
        for (int i = 2; i <= x / i; ++i) {
            if (x % i == 0) {
                return false;
            }
        }
        return true;
    }

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter wr = new BufferedWriter(new OutputStreamWriter(System.out));
        String[] words = br.readLine().split(" ");
        int n = Integer.parseInt(words[0]);
        for (int i = 0; i < n; ++i) {
            words = br.readLine().split(" ");
            if (isPrime(Integer.parseInt(words[0]))) {
                wr.write("Yes\n");
            } else {
                wr.write("No\n");
            }
        }
        wr.flush();
    }
}